import 'package:flutter/material.dart';

class ListCase extends StatelessWidget {
const ListCase({ Key? key }) : super(key: key);

List<Widget> getList() {
  List<Widget> list = [];
  for (var i = 0; i < 10; i++) {
 list.add(Container(
  width: double.infinity,
  margin: EdgeInsets.all(10),
  decoration: BoxDecoration(color:Colors.red,borderRadius: BorderRadius.circular(10)),
  height: 100,
  alignment: Alignment.center,

  child: Text('这是第${i+1}个元素',
  style:TextStyle(color: Colors.white,fontSize: 30)),
 )) ; }
 return list; 
  }


  @override
  Widget build(BuildContext context){
    return ListView(
      children: getList(),
    );
  }
}